@@ -33,8 +33,8 @@ gem 'nokogiri' |
||
33 | 33 |
gem 'wunderground' |
34 | 34 |
gem 'rturk' |
35 | 35 |
|
36 |
-gem "twitter" |
|
37 |
-gem 'twitter-stream', '>=0.1.16' |
|
36 |
+gem "twitter", '~> 5.7.1' |
|
37 |
+gem 'twitter-stream', :git => 'https://github.com/cantino/twitter-stream', :branch => 'master' |
|
38 | 38 |
gem 'em-http-request' |
39 | 39 |
gem 'weibo_2' |
40 | 40 |
|
@@ -1,3 +1,13 @@ |
||
1 |
+GIT |
|
2 |
+ remote: https://github.com/cantino/twitter-stream |
|
3 |
+ revision: fde6bed2b62ca487d49e4a57381bbfca6e33361b |
|
4 |
+ branch: master |
|
5 |
+ specs: |
|
6 |
+ twitter-stream (0.1.15) |
|
7 |
+ eventmachine (>= 0.12.8) |
|
8 |
+ http_parser.rb (~> 0.6.0) |
|
9 |
+ simple_oauth (~> 0.2.0) |
|
10 |
+ |
|
1 | 11 |
GEM |
2 | 12 |
remote: https://rubygems.org/ |
3 | 13 |
specs: |
@@ -31,6 +41,7 @@ GEM |
||
31 | 41 |
multi_json (~> 1.0) |
32 | 42 |
addressable (2.3.5) |
33 | 43 |
arel (3.0.3) |
44 |
+ atomic (1.1.14) |
|
34 | 45 |
bcrypt-ruby (3.1.1) |
35 | 46 |
better_errors (1.1.0) |
36 | 47 |
coderay (>= 1.0.0) |
@@ -40,6 +51,7 @@ GEM |
||
40 | 51 |
bootstrap-kaminari-views (0.0.2) |
41 | 52 |
kaminari (>= 0.13) |
42 | 53 |
rails (>= 3.1) |
54 |
+ buftok (0.2.0) |
|
43 | 55 |
builder (3.0.4) |
44 | 56 |
coderay (1.0.9) |
45 | 57 |
coffee-rails (3.2.2) |
@@ -49,7 +61,7 @@ GEM |
||
49 | 61 |
coffee-script-source |
50 | 62 |
execjs |
51 | 63 |
coffee-script-source (1.6.3) |
52 |
- cookiejar (0.3.0) |
|
64 |
+ cookiejar (0.3.1) |
|
53 | 65 |
coveralls (0.7.0) |
54 | 66 |
multi_json (~> 1.3) |
55 | 67 |
rest-client |
@@ -75,14 +87,15 @@ GEM |
||
75 | 87 |
dotenv (0.9.0) |
76 | 88 |
dotenv-rails (0.9.0) |
77 | 89 |
dotenv (= 0.9.0) |
78 |
- em-http-request (1.0.3) |
|
79 |
- addressable (>= 2.2.3) |
|
90 |
+ em-http-request (1.1.2) |
|
91 |
+ addressable (>= 2.3.4) |
|
80 | 92 |
cookiejar |
81 |
- em-socksify |
|
82 |
- eventmachine (>= 1.0.0.beta.4) |
|
83 |
- http_parser.rb (>= 0.5.3) |
|
93 |
+ em-socksify (>= 0.3) |
|
94 |
+ eventmachine (>= 1.0.3) |
|
95 |
+ http_parser.rb (>= 0.6.0) |
|
84 | 96 |
em-socksify (0.3.0) |
85 | 97 |
eventmachine (>= 1.0.0.beta.4) |
98 |
+ equalizer (0.0.9) |
|
86 | 99 |
erector (0.9.0) |
87 | 100 |
treetop (>= 1.2.3) |
88 | 101 |
erubis (2.7.0) |
@@ -92,8 +105,8 @@ GEM |
||
92 | 105 |
eventmachine (1.0.3) |
93 | 106 |
execjs (1.4.0) |
94 | 107 |
multi_json (~> 1.0) |
95 |
- faraday (0.8.7) |
|
96 |
- multipart-post (~> 1.1) |
|
108 |
+ faraday (0.9.0) |
|
109 |
+ multipart-post (>= 1.2, < 3) |
|
97 | 110 |
fastercsv (1.5.5) |
98 | 111 |
ffi (1.9.0) |
99 | 112 |
foreman (0.63.0) |
@@ -106,7 +119,9 @@ GEM |
||
106 | 119 |
rails (~> 3.0) |
107 | 120 |
hashie (2.0.5) |
108 | 121 |
hike (1.2.3) |
109 |
- http_parser.rb (0.5.3) |
|
122 |
+ http (0.5.0) |
|
123 |
+ http_parser.rb |
|
124 |
+ http_parser.rb (0.6.0) |
|
110 | 125 |
httparty (0.11.0) |
111 | 126 |
multi_json (~> 1.0) |
112 | 127 |
multi_xml (>= 0.5.2) |
@@ -116,7 +131,7 @@ GEM |
||
116 | 131 |
jquery-rails (3.0.4) |
117 | 132 |
railties (>= 3.0, < 5.0) |
118 | 133 |
thor (>= 0.14, < 2.0) |
119 |
- json (1.8.0) |
|
134 |
+ json (1.8.1) |
|
120 | 135 |
jsonpath (0.5.3) |
121 | 136 |
multi_json |
122 | 137 |
jwt (0.1.8) |
@@ -129,13 +144,16 @@ GEM |
||
129 | 144 |
mail (2.5.4) |
130 | 145 |
mime-types (~> 1.16) |
131 | 146 |
treetop (~> 1.4.8) |
147 |
+ memoizable (0.4.0) |
|
148 |
+ thread_safe (~> 0.1.3) |
|
132 | 149 |
method_source (0.8.1) |
133 | 150 |
mime-types (1.24) |
134 | 151 |
mini_portile (0.5.1) |
135 | 152 |
multi_json (1.7.9) |
136 | 153 |
multi_xml (0.5.5) |
137 |
- multipart-post (1.2.0) |
|
154 |
+ multipart-post (2.0.0) |
|
138 | 155 |
mysql2 (0.3.13) |
156 |
+ naught (1.0.0) |
|
139 | 157 |
nokogiri (1.6.0) |
140 | 158 |
mini_portile (~> 0.5.0) |
141 | 159 |
oauth2 (0.9.2) |
@@ -212,7 +230,7 @@ GEM |
||
212 | 230 |
thor (~> 0.14) |
213 | 231 |
shoulda-matchers (2.2.0) |
214 | 232 |
activesupport (>= 3.0.0) |
215 |
- simple_oauth (0.1.9) |
|
233 |
+ simple_oauth (0.2.0) |
|
216 | 234 |
simplecov (0.8.2) |
217 | 235 |
docile (~> 1.1.0) |
218 | 236 |
multi_json |
@@ -231,6 +249,8 @@ GEM |
||
231 | 249 |
libv8 (~> 3.16.14.0) |
232 | 250 |
ref |
233 | 251 |
thor (0.18.1) |
252 |
+ thread_safe (0.1.3) |
|
253 |
+ atomic |
|
234 | 254 |
tilt (1.4.1) |
235 | 255 |
tins (0.13.1) |
236 | 256 |
treetop (1.4.15) |
@@ -240,14 +260,17 @@ GEM |
||
240 | 260 |
builder (>= 2.1.2) |
241 | 261 |
jwt (>= 0.1.2) |
242 | 262 |
multi_json (>= 1.3.0) |
243 |
- twitter (4.4.0) |
|
244 |
- faraday (~> 0.8) |
|
245 |
- multi_json (~> 1.3) |
|
246 |
- simple_oauth (~> 0.1.6) |
|
247 |
- twitter-stream (0.1.16) |
|
248 |
- eventmachine (>= 0.12.8) |
|
249 |
- http_parser.rb (~> 0.5.1) |
|
250 |
- simple_oauth (~> 0.1.4) |
|
263 |
+ twitter (5.7.1) |
|
264 |
+ addressable (~> 2.3) |
|
265 |
+ buftok (~> 0.2.0) |
|
266 |
+ equalizer (~> 0.0.9) |
|
267 |
+ faraday (~> 0.9.0) |
|
268 |
+ http (~> 0.5.0) |
|
269 |
+ http_parser.rb (~> 0.6.0) |
|
270 |
+ json (~> 1.8) |
|
271 |
+ memoizable (~> 0.4.0) |
|
272 |
+ naught (~> 1.0) |
|
273 |
+ simple_oauth (~> 0.2.0) |
|
251 | 274 |
typhoeus (0.6.3) |
252 | 275 |
ethon (~> 0.5.11) |
253 | 276 |
tzinfo (0.3.38) |
@@ -309,8 +332,8 @@ DEPENDENCIES |
||
309 | 332 |
system_timer |
310 | 333 |
therubyracer |
311 | 334 |
twilio-ruby |
312 |
|
|
313 |
- twitter-stream (>= 0.1.16) |
|
335 |
+ twitter (~> 5.7.1) |
|
336 |
+ twitter-stream! |
|
314 | 337 |
typhoeus |
315 | 338 |
uglifier (>= 1.0.3) |
316 | 339 |
webmock |
@@ -3,7 +3,6 @@ module TwitterConcern |
||
3 | 3 |
|
4 | 4 |
included do |
5 | 5 |
validate :validate_twitter_options |
6 |
- after_initialize :configure_twitter |
|
7 | 6 |
end |
8 | 7 |
|
9 | 8 |
def validate_twitter_options |
@@ -31,12 +30,12 @@ module TwitterConcern |
||
31 | 30 |
options['oauth_token_secret'].presence || options['access_secret'].presence || credential('twitter_oauth_token_secret') |
32 | 31 |
end |
33 | 32 |
|
34 |
- def configure_twitter |
|
35 |
- Twitter.configure do |config| |
|
33 |
+ def twitter |
|
34 |
+ Twitter::REST::Client.new do |config| |
|
36 | 35 |
config.consumer_key = twitter_consumer_key |
37 | 36 |
config.consumer_secret = twitter_consumer_secret |
38 |
- config.oauth_token = twitter_oauth_token |
|
39 |
- config.oauth_token_secret = twitter_oauth_token_secret |
|
37 |
+ config.access_token = twitter_oauth_token |
|
38 |
+ config.access_token_secret = twitter_oauth_token_secret |
|
40 | 39 |
end |
41 | 40 |
end |
42 | 41 |
end |
@@ -3,6 +3,7 @@ require "twitter" |
||
3 | 3 |
module Agents |
4 | 4 |
class TwitterPublishAgent < Agent |
5 | 5 |
include TwitterConcern |
6 |
+ |
|
6 | 7 |
cannot_be_scheduled! |
7 | 8 |
|
8 | 9 |
description <<-MD |
@@ -62,7 +63,7 @@ module Agents |
||
62 | 63 |
end |
63 | 64 |
|
64 | 65 |
def publish_tweet(text) |
65 |
- Twitter.update(text) |
|
66 |
+ twitter.update(text) |
|
66 | 67 |
end |
67 | 68 |
end |
68 | 69 |
end |
@@ -1,6 +1,7 @@ |
||
1 | 1 |
module Agents |
2 | 2 |
class TwitterStreamAgent < Agent |
3 | 3 |
include TwitterConcern |
4 |
+ |
|
4 | 5 |
cannot_receive_events! |
5 | 6 |
|
6 | 7 |
description <<-MD |
@@ -69,7 +69,7 @@ module Agents |
||
69 | 69 |
opts = {:count => 200, :include_rts => true, :exclude_replies => false, :include_entities => true, :contributor_details => true} |
70 | 70 |
opts.merge! :since_id => since_id unless since_id.nil? |
71 | 71 |
|
72 |
- tweets = Twitter.user_timeline(options['username'], opts) |
|
72 |
+ tweets = twitter.user_timeline(options['username'], opts) |
|
73 | 73 |
|
74 | 74 |
tweets.each do |tweet| |
75 | 75 |
memory['since_id'] = tweet.id if !memory['since_id'] || (tweet.id > memory['since_id']) |